/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package textfilewriter.entity.fact;

import java.text.SimpleDateFormat;
import java.util.Date;
import textfilewriter.entity.dimension.Customer;

/**
 *
 * @author GiangLT
 */
public class PreRatedCdr {

    private Date date;
    private Customer customer;
    private String serviceName;
    private String networkName;
    private boolean failed;
    private double provisioningCost;
    private float failureRate;

    public PreRatedCdr() {
    }

    public Customer getCustomer() {
        return customer;
    }

    public void setCustomer(Customer customer) {
        this.customer = customer;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public boolean isFailed() {
        return failed;
    }

    public void setFailed(boolean failed) {
        this.failed = failed;
    }

    public float getFailureRate() {
        return failureRate;
    }

    public void setFailureRate(float failureRate) {
        this.failureRate = failureRate;
    }

    public String getNetworkName() {
        return networkName;
    }

    public void setNetworkName(String networkName) {
        this.networkName = networkName;
    }

    public double getProvisioningCost() {
        return provisioningCost;
    }

    public void setProvisioningCost(double provisioningCost) {
        this.provisioningCost = provisioningCost;
    }

    public String getServiceName() {
        return serviceName;
    }

    public void setServiceName(String serviceName) {
        this.serviceName = serviceName;
    }

    @Override
    public String toString() {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        StringBuilder sb = new StringBuilder();
        sb.append(dateFormat.format(date));
        sb.append("|");
        sb.append(customer.getCustFirstName());
        sb.append(" ");
        sb.append(customer.getCustLastName());
        sb.append("|");
        sb.append(customer.getCustStreetAddress());
        sb.append("|");
        sb.append(networkName);
        sb.append("|");
        sb.append(serviceName);
        sb.append("|");
        sb.append(failed);
        sb.append("|");
        sb.append(provisioningCost);

        return sb.toString();
    }

    public String getHeader() {
        return "Date|Customer name|Customer Address|Network|Service|Failed|Provisioning Cost";
    }
}
